package com.fz.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fz.core.BaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

/**
 * <p>
 * 存储商品类别信息
 * </p>
 *
 * @author hyr
 * @since 2025-06-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Category extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 父分类ID（0表示根分类）
     */
    private Long parentId;

    /**
     * 分类层级（1/2/3级）
     */
    private Integer level;

    /**
     * 分类描述
     */
    private String description;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;


    // 孩子 生成sql语句时忽略
    @TableField(exist = false)
    private List<Category> children;

    public Category(String name, Long parentId, Integer level, String description) {
        this.name = name;
        this.parentId = parentId;
        this.level = level;
        this.description = description;
    }

    public Category(Long id, String name, Long parentId, Integer level, String description) {
        super(id);
        this.name = name;
        this.parentId = parentId;
        this.level = level;
        this.description = description;
    }

}
